package outils;

public class PileOperations {
	private Operation [] tab;
	private int tete;
	private int taille = 100;
	
	public PileOperations() {
		this.tab = new Operation[this.taille];
		this.tete = 0;
	}
	
	public void empiler(Operation o) {
		if(tete < this.taille)
			this.tab[tete++] = o;
	}
	
	public Operation depiler() {
		if(tete > 0)
			return this.tab[--tete];
		else 
			return null;
	}
	
	public Operation getElementAt(int i) {
		return this.tab[i];
	}
	
	public Operation getElementEnTete() {
		return this.tab[this.tete-1];
	}
	
	public Operation[] getTab() {
		return this.tab;
	}
	
	public int getTete() {
		return this.tete;
	}
	
	public boolean estVide() {
		return this.tete == 0;
	}
	
	public boolean estPleine() {
		return this.tete == this.taille;
	}
	
	public void vider() {
		this.tete = 0;
	}
}
